package cn.edu.sptc.fanjing.hellospring.runner;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

@Slf4j
@Component
public class MyAppLicationRunner implements ApplicationRunner {
    @Override
    public void run(ApplicationArguments args) throws Exception {
        log.info("应用冷启动完成报时，当前时刻为：{}", getDateTimeByCurrentTimeMillis());
        }
    public static String getDateTimeByCurrentTimeMillis(){
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:sss EEE");
//        return dateFormat.format(System.currentTimeMillis());
        return dateFormat.format((new Date()));
    }
}
